import 'package:flutter/material.dart';
import 'package:flutter_widget/src/config/color_define.dart';
import 'package:flutter_widget/src/widget/tap_widget.dart';
import 'package:flutter_widget/src/widget/text/text_format.dart';

///垂直显示图标数字的按键
class ColumnIconButton extends StatelessWidget {
  final Widget? icon;
  final String? text;
  final Function? onTap;
  final Color? textColor;
  final double? fontSize;
  final double? horizontalPadding;
  final double? verticalPadding;
  final double? height;
  final bool textShadow;

  const ColumnIconButton({
    Key? key,
    this.icon,
    this.text,
    this.onTap,
    this.verticalPadding,
    this.textColor,
    this.fontSize,
    this.horizontalPadding,
    this.height,
    this.textShadow = true,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: height,
      padding: EdgeInsets.symmetric(
        vertical: verticalPadding ?? 10,
        horizontal: horizontalPadding ?? 0,
      ),
      child: Column(
        children: [
          TapWidget(
            onTap: onTap as void Function()?,
            child: icon ?? Container(),
          ),
          Container(height: 2),
          TextFormatWidget(
            text ?? '??',
            fontSize: fontSize ?? 12,
            height: 1,
            isShadow: textShadow,
            color: textColor ?? FWColorPicker.white,
          ),
        ],
      ),
    );
  }
}
